#pragma once

#include "stdafx.h"
#include "ref_counter.h"

namespace async_curl {
	class curl_event_loop;

	class curl_ctx {
	public:
		explicit curl_ctx(curl_event_loop* mgr, curl_socket_t fd);
		~curl_ctx();

		void chpoll(int evt);

		void stop();

	private:
		static void poll_cb(uv_poll_t* handle, int status, int events);
		static void stop_cb(uv_handle_t* handle);

	private:
		curl_event_loop * mgr_;
		curl_socket_t sock_fd_;
		uv_poll_t* poll_;
		ref_counter counter_;
	};
}
